---
category: Level 1 — Basic
created: '2020-02-16'
keywords:
title: Remove an element
---

## 1. Use the remove method

Note that the [`remove`](https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove) method isn't supported in Internet Explorer.

```js
ele.remove();
```

## 2. Use the removeChild method

```js
if (ele.parentNode) {
    ele.parentNode.removeChild(ele);
}
```

## See also

-   [Calculate the size of scrollbar](https://phuoc.ng/collection/html-dom/calculate-the-size-of-scrollbar/)
-   [Copy text to the clipboard](https://phuoc.ng/collection/html-dom/copy-text-to-the-clipboard/)
-   [Download a file](https://phuoc.ng/collection/html-dom/download-a-file/)
-   [Drag and drop element in a list](https://phuoc.ng/collection/html-dom/drag-and-drop-element-in-a-list/)
-   [Drag and drop table column](https://phuoc.ng/collection/html-dom/drag-and-drop-table-column/)
-   [Drag and drop table row](https://phuoc.ng/collection/html-dom/drag-and-drop-table-row/)
-   [Measure the width of given text of given font](https://phuoc.ng/collection/html-dom/measure-the-width-of-given-text-of-given-font/)
-   [Print an image](https://phuoc.ng/collection/html-dom/print-an-image/)
-   [Remove all children of a node](https://phuoc.ng/collection/html-dom/remove-all-children-of-a-node/)
-   [Show a ghost element when dragging an element](https://phuoc.ng/collection/html-dom/show-a-ghost-element-when-dragging-an-element/)
-   [Show a loading indicator when an iframe is being loaded](https://phuoc.ng/collection/html-dom/show-a-loading-indicator-when-an-iframe-is-being-loaded/)
-   [Sort a table by clicking its headers](https://phuoc.ng/collection/html-dom/sort-a-table-by-clicking-its-headers/)
